﻿@using GoodMan.Infrastructure.Entities.Entity;
@{
    Layout = "~/Views/Shared/_Main.cshtml";
    var areacode = ViewBag.areaCode;
    ItemListBox<Product> productlist = ViewBag.productList;
    var type = ViewBag.Type;
    var areacodeStr = "普通商品";
    if (areacode == 2)
    {
        areacodeStr = "校园团购";
    }
    else if (areacode == 3)
    {
        areacodeStr = "积分商城";
    }
    else if (areacode == 1)
    {
        if (type == 1)
        {
            areacodeStr = "普通商品";
        }
        else if (type == 2)
        {
            areacodeStr = "特别推荐";
        }
        else if (type == 3)
        {
            areacodeStr = "限时特卖";
        }
    }
    ViewBag.Title = areacodeStr;
}
<!--#主菜单-->
<ul class="breadcrumb">
    <li><a href="../home/index">首页</a> <span class="divider">></span></li>
    <li class="active">@areacodeStr</li>
</ul>
<!--//////////////////////////////////////////////////////////////////////////////////-->
<div class="row">
    <div class="span3">
        <!--商家推荐-->
        <div class="title-line title-line-red">
            <h4>
                畅销商品</h4>
        </div>
        <!--list-->
        <ul class="media-list" id="fiveRecommended">
            
        </ul>
        <!--#list-->
        <!--#商家推荐-->
        <div>
        </div>
        <!--//////////////////////////////////////////////////////////////////////////////////-->
        
        <!--//////////////////////////////////////////////////////////////////////////////////-->
        <div class="ad-banner-left">
            <!--AD-->
            <!--AD:220x60-->
        @{GoodMan.Tool.Configration.SiteResource.BlockItem adv = GoodMan.Tool.Configration.SiteResource.Block.FirstOrDefault(c => c.Key == "4").Items.FirstOrDefault();}
            @if (adv != null)
            { 
                <a href="@adv.href">
                <img src="@adv.img" alt="@adv.alt" /></a> 
            }
            <!--#AD-->
        </div>
        <!--浏览记录-->
        
        <!--#浏览记录-->
    </div>
    <div class="span9">
        <!--商品快速过虑-->
        
        <!--#商品快速过虑-->
        <!--//////////////////////////////////////////////////////////////////////////////////-->
        <div class="row-fluid product-x2">
            <!--商品列表-->
            @{
                if (productlist != null && productlist.Data != null && productlist.Data.Any())
                {
                    foreach (var item in productlist.Data)
                    {
                        string url = "/shop/ProductItemView?id=" + item.Id;
                        if (areacode == 1)
                        {
                            
                            if (type == 1)
                            {
                                <div class="product">
                                    <a href="@url" target="_blank">
                                        <img src="@item.Images" style="width:140px;height:93px;" alt="@item.ProductName" title="@item.ProductName"/></a>
                                    <div class="p-name">
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                        价格:<span class="price" style="color:#DC143C;font-weight:bold;">&yen;@item.DefaulSalePrice</span>
                                    </div>
                                </div>
                            }
                            else if (type == 2)
                            {
                                <div class="product">
                                    <a href="@url"  target="_blank">
                                        <img src="@item.Images" style="width:140px;height:93px;" alt="@item.ProductName" title="@item.ProductName"/></a>
                                    <div class="p-name">
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                        推荐价:<span class="price" style="color:#DC143C;font-weight:bold;">&yen;@item.DefaulSalePrice</span>
                                    </div>
                                </div>
                            }
                            else if (type == 3)
                            {
                                <div class="product">
                                    <a href="@url"  target="_blank">
                                        <img src="@item.Images" style="width:140px;height:93px;" alt="@item.ProductName" title="@item.ProductName"/></a>
                                    <div class="p-name">
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                        原价:<span><s>&yen;@item.DefaulSalePrice</s></span><br />特价:<span class="price"  style="color:#DC143C;font-weight:bold;">&yen;@item.PolicyPrice</span>
                                    </div>
                                </div>
                            }
                        }
                        else if (areacode == 2)
                        {
                            <div class="product">
                                    <a href="@url"  target="_blank">
                                        <img src="@item.Images" style="width:140px;height:93px;" alt="@item.ProductName" title="@item.ProductName"/></a>
                                    <div class="p-name">
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                        原价:<span><s>&yen;@item.OriginalPrice</s></span><br />团购价:<span class="price"  style="color:#DC143C;font-weight:bold;">&yen;@item.DefaulSalePrice</span>
                                    </div>
                                </div>
                        }
                        else if (areacode == 3)
                        {
                            <div class="product">
                                    <a href="@url"  target="_blank">
                                        <img src="@item.Images" style="width:140px;height:93px;" alt="@item.ProductName" title="@item.ProductName"/></a>
                                    <div class="p-name">
                                        <div style="height: 40px; overflow: hidden">
                                            <a href="@url"  target="_blank" title="@item.ProductName">@item.ProductName</a></div>
                                        积分:<span class="price" style="color:#DC143C;font-weight:bold;">@item.Integral 分</span>
                                    </div>
                                </div>
                        }


                    }
                }
                else
                {
                   <div style="margin-left:80px; margin-top:80px"><p style="vertical-align:middle">
                <b style="font-size: 20px; color: Green">即将开启，敬请期待！</b></p></div>
                 
                }
            }
             
            <!--#商品列表-->
        </div>
        <!--分页-->
        <div class="pagination text-right">
             <hr />
                                @Html.Raw(productlist.PageItemSegment)
        </div>
        <!--#分页-->
    </div>
</div>
@section tail{
    <script type="text/javascript">
        $(document).ready(function (e) {
            $.post("/Shop/GetFiveRecommended", { type: 1 }, function (response) {
                $("#fiveRecommended").html(response);
            });
        });
    </script>
    
      
}